<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-03-10 23:49:19
 * @LastEditTime: 2022-03-11 00:01:17
 * @LastEditors: CHINAKAIYUAN
 * @Description: 
 */
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-03-10 23:28:10
 * @LastEditTime: 2022-03-10 23:30:28
 * @LastEditors: CHINAKAIYUAN
 * @Description: 
 */

namespace App\Models;

use Illuminate\Support\Facades\Storage;

class TableReport extends BaseModel
{
    //
    public $table = "basedata_table_report";
    protected $guarded = [];
    protected $appends = ['url'];
    public function filters()
    {
        return "";
    }
    public function children()
    {
        return $this->hasMany(get_class($this), 'parent_id', 'id')->orderBy("sort", 'asc');
    }
    public function gridtable()
    {
        return $this->belongsTo(Table::class, "table_id");
    }
    public function getUrlAttribute()
    {
        return Storage::disk("report")->url($this->filepath);
    }
    //保证不保存没有的列URL
    public function setUrlAttribute($value)
    {
        return;
    }
}
